package com.duobaoyu.dby.supply.db.entity.message;

import com.baomidou.mybatisplus.annotation.*;
import com.duobaoyu.dby.supply.db.constant.SupplyMapperConstant;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import lombok.experimental.SuperBuilder;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Field;

import java.time.LocalDateTime;

/**
 * @author liyang
 * @version 1.0.0
 * @ClassName ChannelMessage
 * @Description 渠道消息表
 * @createTime 08:50:00 2023/09/27
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@ApiModel(value = "渠道消息表")
//@EqualsAndHashCode(callSuper = true)
@SuperBuilder(builderMethodName = "bBuilder")
@TableName(value = SupplyMapperConstant.CHANNEL_MESSAGE_TABLE_NAME, autoResultMap = true)
public class ChannelMessage /*extends BaseEntity*/ {
	private static final long serialVersionUID = -1047967629439248408L;
	/**
	 * 主键消息ID
	 */
	@Id
	@ApiModelProperty(value = "主键消息ID")
	@TableId(type = IdType.INPUT)
	private String id;

	/**
	 * 渠道编号
	 */
	@Field("channel_code")
	@ApiModelProperty(value = "渠道编号")
	private String channelCode;
	/**
	 * 对接渠道配置Key
	 */
	@Field("config_unique_key")
	@ApiModelProperty(value = "对接渠道配置Key")
	private String configUniqueKey;
	/**
	 * 请求ID
	 */
	@Field("request_id")
	@ApiModelProperty(value = "请求ID")
	private String requestId;
	/**
	 * 渠道原消息体(压缩后的)
	 */
	@Field("original_message")
	@ApiModelProperty(value = "渠道原消息体(压缩后的)")
	private String originalMessage;

	/**
	 * 唯一key（MD5值）
	 */
	@Field("unique_key")
	@ApiModelProperty(value = "唯一key（MD5值）")
	private String uniqueKey;

	/**
	 * 消息类型
	 * //@see com.duobaoyu.dby.channel.adapter.enums.BizMessageTypeEnum
	 */
	@Field("message_type")
	@ApiModelProperty(value = "消息类型")
	private Integer messageType;

	/**
	 * 业务消息体-JSON压缩
	 */
	@Field("message")
	@ApiModelProperty(value = "业务消息体-JSON压缩")
	private String message;

	/**
	 * 是否是批量消息 0->否 1->是
	 */
	@Field("is_batch")
	@ApiModelProperty(value = "是否是批量消息 0->否 1->是")
	private Boolean isBatch;

	/**
	 * 消息重试次数
	 */
	@Field("retry_count")
	@ApiModelProperty(value = "消息重试次数")
	private Integer retryCount;

	/**
	 * 状态 1->待处理；2->处理成功；3->处理失败
	 * //@see com.duobaoyu.dby.channel.adapter.enums.biz.message.MessageStatusEnum
	 */
	@Field("status")
	@ApiModelProperty(value = "状态 1->待处理；2->处理成功；3->处理失败")
	private Integer status;

	/**
	 * 来源Class
	 */
	@Field("source_class")
	@ApiModelProperty(value = "来源Class")
	private String sourceClass;

	/**
	 * 操作编号，订单编号、商品编号、售后编号
	 */
	@Field("operational_code")
	@ApiModelProperty(value = "操作编号，订单编号、商品编号、售后编号")
	private String operationalCode;

	/**
	 * 渠道操作编号，渠道订单编号、渠道商品编号、渠道售后编号
	 */
	@Field("channel_operational_code")
	@ApiModelProperty(value = "渠道操作编号，渠道订单编号、渠道商品编号、渠道售后编号")
	private String channelOperationalCode;

	/**
	 * 备注
	 */
	@Field("remark")
	@ApiModelProperty(value = "备注")
	private String remark;
	/**
	 * 版本号-用作乐观锁
	 */
	@Version
	@Field("version")
	@ApiModelProperty(value = "版本号-用作乐观锁")
	private Integer version;
	/**
	 * 是否删除 0-否 1-是
	 */
	@Field("del_flag")
	@TableLogic(value = "0", delval = "1")
	@ApiModelProperty(value = "是否删除 0-否 1-是")
	private Integer delFlag;

	@Field("create_by")
	@TableField(fill = FieldFill.INSERT)
	private String createBy;

	@Field("create_time")
	@TableField(fill = FieldFill.INSERT)
	private LocalDateTime createTime;

	@Field("update_by")
	@TableField(fill = FieldFill.INSERT_UPDATE)
	private String updateBy;

	@Field("update_time")
	@TableField(fill = FieldFill.INSERT_UPDATE)
	private LocalDateTime updateTime;
}
